import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

import Layout from '@/views/layout'
import Article from '../views/article.vue'
import Collect from '../views/collect.vue'
import Like from '../views/like.vue'
import User from '../views/user.vue'
import Detail from '../views/detail.vue'

const router = new VueRouter({
  routes: [
    {
      path: '/',
      redirect: '/article',
    },

    {
      path: '/layout',
      component: Layout,
      children: [
        {
          path: '/article',
          component: Article,
        },
        {
          path: '/collect',
          component: Collect,
        },
        {
          path: '/like',
          component: Like,
        },
        {
          path: '/user',
          component: User,
        },
      ],
    },
    {
      name: 'Detail',
      path: '/detail/:id',
      component: Detail,
    },
  ],
})

export default router
